Title: SQL BT (By-BKK) / 14 Update
Tags: Obsidian_to_Anki

Q: What SQL statement do you use to change data in a table?
A: UPDATE

Q: How do you specify which columns to change in the UPDATE statement?
A: List the columns and new values after SET

Q: How do you update values in specific rows using SQL?
A: Use a WHERE clause to match rows

Q: True/False: UPDATE without WHERE changes all rows
A: True

Q: What happens if you don’t use a WHERE clause in an UPDATE?
A: All rows in the table are updated

Q: Give an example of setting a new director for a movie using UPDATE
A: UPDATE movies SET director = 'John Lasseter' WHERE title = 'A Bug's Life';

Q: How can you update multiple columns at once in SQL?
A: List each column and value with commas in the SET clause

Q: What should you do before running an UPDATE with a WHERE condition?
A: Run a SELECT with the same WHERE condition to check which rows match

Q: True/False: You can only update one column at a time with UPDATE
A: False

Q: Why is it dangerous to omit a WHERE clause in UPDATE?
A: It updates every row in the table

Q: What must match between your new data and the table’s schema in UPDATE?
A: The data types

Q: What happens if UPDATE runs without a WHERE clause?
A: All rows get updated if you skip the WHERE clause in UPDATE

Q: What is a safe practice before running an UPDATE statement?
A: You should test your WHERE condition with SELECT first before updating

Q: True/False: UPDATE can set several columns to new values at once
A: Multiple columns can be changed in a single UPDATE

Q: What do you use to modify data in an existing SQL table?
A: UPDATE statement